enum UserRole {
  STUDENT = 0,
  TEACHER = 1,
  ADMIN = 2,
}

enum UserRoleInfo {
  STUDENT = '学生',
  TEACHER = '教师',
  ADMIN = '管理员',
}

enum UserRoleColor {
  STUDENT = 'green',
  TEACHER = 'blue',
  ADMIN = 'gold',
}

// 根据value 取值string
const getUserRoleInfoByRoleValue = (role: number): string => {
  const roleKey = UserRole[role];
  if (!roleKey) return '未知角色';
  return UserRoleInfo[roleKey as keyof typeof UserRoleInfo] || '未知角色';
};

// 根据value 获取颜色
const getUserRoleColorByRoleValue = (role: number): string => {
  const roleKey = UserRole[role];
  if (!roleKey) return 'green';
  return UserRoleColor[roleKey as keyof typeof UserRoleColor] || 'green';
};

export { getUserRoleColorByRoleValue, getUserRoleInfoByRoleValue };
